/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.karol.lx.agent;

import java.io.IOException;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author karol
 */
public class JGraderAgent {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        if (System.getSecurityManager() == null)
            System.setSecurityManager(new RMISecurityManager());
        
        LocateRegistry.createRegistry(2020);
        try {
            StandardGraderAgent tAgent = new StandardGraderAgent(5); //TODO: config parallel grader number
            Naming.rebind("//127.0.0.1:2020/GraderAgent", tAgent);
            System.out.println("Registry added");
        } catch (MalformedURLException ex) {
            Logger.getLogger(JGraderAgent.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            Logger.getLogger(JGraderAgent.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
